import Router from 'vue-router'
Vue.use(Router)


// 解决编程式路由往同一地址跳转时会报错的情况
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;

// push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch(err => err);
};

//replace
Router.prototype.replace = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalReplace.call(this, location, onResolve, onReject);
  return originalReplace.call(this, location).catch(err => err);
};


export default new Router({
	mode: 'history',
	base: '/h5',

	routes: [
    {
      path: '/',
      redirect:'/bisai'
    },

    // {
    //     path: '/login',
    //     component: () => import('@/admin/login'),
    //     mete:{
    //       title:"注册登录",
    //     }
    // },

    {
    	path: '/bisai',
      component: () => import('@/esports/bisai/index'),
      redirect:'/bisai',
      children:[
        {
          path: '/bisai',
          component: () => import('@/esports/bisai/list'),
          mete:{
            title:"比赛列表",
          },
        },
        {
          path: '/bisai/detail',
          component: () => import('@/esports/bisai/detail'),
          mete:{
            title:"比赛详情",
          },
        }
      ]
    },

    {
    	path: '/wode',
      component: () => import('@/esports/wode/index'),
      redirect:'/wode',
      children:[
        {
          path: '/wode',
          component: () => import('@/esports/wode/detail'),
          mete:{
            title:"个人中心",
          },
        }
      ]
    },
    {
    	path: '/chengji',
      component: () => import('@/esports/chengji/index'),
      redirect:'/chengji',
      children:[
        {
          path: '/chengji',
          component: () => import('@/esports/chengji/detail'),
          mete:{
            title:"成绩列表",
          },
        },
        {
          path: '/zhengshu',
          component: () => import('@/esports/chengji/zhengshu'),
          mete:{
            title:"证书",
          },
        },
        {
          path: '/tuiguang',
          component: () => import('@/esports/chengji/tuiguang'),
          mete:{
            title:"推广",
          },
        },
        {
          path: '/tuiguangtudan',
          component: () => import('@/esports/chengji/tuiguangtudan'),
          mete:{
            title:"推广图",
          },
        },


      ]
    }
	]
})
